/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/3/3
 * Time: 17:26
 * Description: No Description
 */
import java.util.*;
public class TestDemo {
    public static void Dst(char pos1 ,char pos2) {
        System.out.print(pos1+"->"+pos2+" ");
    }
    public static void hanoi(int n,char pos1,char pos2,char pos3) {
        if(n==1) {
            Dst(pos1,pos3);
        }else {
            hanoi(n - 1, pos1, pos3, pos2);
            Dst(pos1, pos3);
            hanoi(n - 1, pos2, pos1, pos3);
        }
    }
    public static void main(String[] args) {
        hanoi(1,'A','B','C');
        System.out.println();
        hanoi(2,'A','B','C');
        System.out.println();
        hanoi(3,'A','B','C');
        System.out.println();
        hanoi(4,'A','B','C');
    }
}